Add which-key-C-h-map-prompt to make it customizable
authorJustin Burkett <justin@burkett.cc>
Wed, 12 Jul 2023 21:51:08 +0000 (17:51 -0400)
committerJustin Burkett <justin@burkett.cc>
Wed, 12 Jul 2023 21:51:08 +0000 (17:51 -0400)
Fixes #350

which-key.el

index f7c4f160625cd2068fb5da328e27a2927837f399..25f2397a9a8af291c7bf7ad9f53a843abb26fa49 100644 (file)
@@ -437,6 +437,25 @@ Only takken into account when popup type is side-window."
   'which-key
   :type 'boolean)
 
+(defvar which-key-C-h-map-prompt
+  (concat " \\<which-key-C-h-map>"
+          " \\[which-key-show-next-page-cycle]"
+          which-key-separator "next-page,"
+          " \\[which-key-show-previous-page-cycle]"
+          which-key-separator "previous-page,"
+          " \\[which-key-undo-key]"
+          which-key-separator "undo-key,"
+          " \\[which-key-toggle-docstrings]"
+          which-key-separator "toggle-docstrings,"
+          " \\[which-key-show-standard-help]"
+          which-key-separator "help,"
+          " \\[which-key-abort]"
+          which-key-separator "abort"
+          " 1..9"
+          which-key-separator "digit-arg")
+  "Prompt to display when invoking `which-key-C-h-map'. This string
+is fed into `substitute-command-keys'")
+
 (defvar which-key-C-h-map
   (let ((map (make-sparse-keymap)))
     (dolist (bind `(("\C-a" . which-key-abort)
@@ -2419,22 +2438,7 @@ prefix) if `which-key-use-C-h-commands' is non nil."
                                   full-prefix
                                   (which-key--propertize
                                    (substitute-command-keys
-                                    (concat
-                                     " \\<which-key-C-h-map>"
-                                     " \\[which-key-show-next-page-cycle]"
-                                     which-key-separator "next-page,"
-                                     " \\[which-key-show-previous-page-cycle]"
-                                     which-key-separator "previous-page,"
-                                     " \\[which-key-undo-key]"
-                                     which-key-separator "undo-key,"
-                                     " \\[which-key-toggle-docstrings]"
-                                     which-key-separator "toggle-docstrings,"
-                                     " \\[which-key-show-standard-help]"
-                                     which-key-separator "help,"
-                                     " \\[which-key-abort]"
-                                     which-key-separator "abort"
-                                     " 1..9"
-                                     which-key-separator "digit-arg"))
+                                    which-key-C-h-map-prompt)
                                    'face 'which-key-note-face)))
                   (key (let ((key (read-key prompt)))
                          (if (numberp key)